#if($msg)
<script>
alert('$!msg');
</script>
#end
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>图片列表</title>
<link href="/include/manage/images/main/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="/include/manage/js/jquery.js"></script>
<script language="javascript" src="/include/manage/js/jquery.tablednd.js"></script>
<script language="javascript">
function checkAll() {
	if($('#selAll').attr("checked")){
		$('input[type=checkbox]').attr('checked', $('#selAll').attr("checked")); 
	}else{
		$('input[type=checkbox]').attr('checked',false);
	}
}

function delSel(){
	if(confirm('确定要删除吗?')){
		var str='';
		$("input[name='sel_id']:checked").each(function(){
			str+=$(this).val()+",";
		});
		if(str.length>0){
			$('#deleteid').val(str);
			$('#delform').submit();
		}
	}
}
</script>
#if($tid)
<script language="javascript">
<!--
var nowOrder=null;

jQuery.ajaxSetup ({  
	cache: false
});

	function showRMenu(x, y) {
		$("#rMenu ul").show();
		$("#rMenu").css({"top":y+"px", "left":x+"px", "display":"block"});
	}
	function hideRMenu() {
		$("#rMenu").hide();
	}

$(document).ready(function() {
    $(document).bind("contextmenu",function(e){
        return false;
    });
	
    $("#list").tableDnD({
		onDragClass: "startDrag",
		onDrop: function(table,row,target){
			var rows = table.tBodies[0].rows;
			if(target!=null){
				reArrange(row.id,target.id);
			}
        },
		dragHandle: "dragHandle"
	});
	
	$(".dragHandle").mousedown(function(e){
		if(3 == e.which){
			nowOrder=$(this.parentNode);
			//alert("这是右键单击事件："+nowOrder.id);
			showRMenu(e.clientX, e.clientY);
		}
	});
});

function reArrange(oldId,newId){
	if(oldId!=newId){
		jQuery.get("/manage_news_ajax.ad" , { parameter : "order", tid : "$tid" , oOrder : oldId , nOrder : newId } );
	}
}

function upOrder(){
	hideRMenu();
	if(nowOrder.prev().length!=0){
		if(nowOrder.prev().prev().length!=0){
			jQuery.get("/manage_news_ajax.ad" , { parameter : "order", tid : "$tid" , oOrder : nowOrder[0].id , nOrder : nowOrder.prev()[0].id } );
			nowOrder.insertBefore(nowOrder.prev());
		}else{
			jQuery.get("/manage_news_ajax.ad" , { parameter : "order", tid : "$tid" , nOrder : nowOrder[0].id },function(data){
			window.location.reload();
			});
		}
	}
}

function downOrder(){
	hideRMenu();
	if(nowOrder.next().length!=0){
		jQuery.get("/manage_news_ajax.ad" , { parameter : "order", tid : "$tid" , oOrder : nowOrder[0].id , nOrder : nowOrder.next()[0].id } );
		nowOrder.insertAfter(nowOrder.next());
	}else{
		jQuery.get("/manage_news_ajax.ad" , { parameter : "order", tid : "$tid" , oOrder : nowOrder[0].id },function(data){
			window.location.reload();
		});
	}
}

function refreshPage(){
	hideRMenu();
	window.location.reload();
}
-->
</script>
#end
<style>
#if($tid)
<!--
.startDrag td{
	border-top:1px solid white;
	border-left:1px solid white;
	border-right:1px solid gray;
	border-bottom:1px solid gray;
	background-color:#F1F1F1;	
}
.dragHandle{
	cursor:move;
}
-->
#end
</style>
</head>
<body>
<form id="delform" name="delform" action="/manage_news.ad" method="post">
	<input type="hidden" name="parameter" value="delete" />
    <input type="hidden" id="deleteid" name="id" value="" />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="30" background="/include/manage/images/main/tab_05.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="12" height="30"><img src="/include/manage/images/main/tab_03.gif" width="12" height="30" /></td>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="46%" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="5%"><div align="center"><img src="/include/manage/images/main/tb.gif" width="16" height="16" /></div></td>
                <td width="95%"><span class="STYLE3">当前位置</span>：[图片管理]-[图片列表]</td>
              </tr>
            </table></td>
            <td width="54%"><table border="0" align="right" cellpadding="0" cellspacing="0">
              <tr>
                <td width="60"><table width="90%" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><div align="center"><a href="/manage_news.ad?parameter=add&tid=$!tid"><img src="/include/manage/images/main/22.gif" width="14" height="14" /></a></div></td>
                    <td><div align="center"><a href="/manage_news.ad?parameter=add&tid=$!tid">新增</a></div></td>
                  </tr>
                </table></td>
                <td width="60"><table width="90%" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><div align="center"><a href="/manage_news.ad?parameter=copy&tid=$!tid"><img src="/include/manage/images/main/22.gif" width="14" height="14" /></a></div></td>
                    <td><div align="center"><a href="/manage_news.ad?parameter=copy&tid=$!tid">复制</a></div></td>
                  </tr>
                </table></td>
                <td width="60"><table width="90%" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><div align="center"><a href="/manage_news.ad?parameter=cut&tid=$!tid"><img src="/include/manage/images/main/22.gif" width="14" height="14" /></a></div></td>
                    <td><div align="center"><a href="/manage_news.ad?parameter=cut&tid=$!tid">移动</a></div></td>
                  </tr>
                </table></td>
                <td width="52"><table width="88%" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><div align="center"><a href="javascript:delSel()"><img src="/include/manage/images/main/11.gif" width="14" height="14" /></a></div></td>
                    <td><div align="center"><a href="javascript:delSel()">删除</a></div></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
        <td width="16"><img src="/include/manage/images/main/tab_07.gif" width="16" height="30" /></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="8" background="/include/manage/images/main/tab_12.gif">&nbsp;</td>
        <td><table id="list" width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#b5d6e6">
          <tr class="nodrop nodrag">
            <td width="24" height="22" background="/include/manage/images/main/bg.gif"><div align="center">
              <input type="checkbox" name="selAll" id="selAll" onClick="checkAll()" />
            </div></td>
            <td width="32" background="/include/manage/images/main/bg.gif"><div align="center"><label for="selAll">全选</label></div></td>
            <td width="*" background="/include/manage/images/main/bg.gif"><div align="center">文章标题</div></td>
            <td width="60" background="/include/manage/images/main/bg.gif"><div align="center">发布人</div></td>
            <td width="120" background="/include/manage/images/main/bg.gif"><div align="center">发布时间</div></td>
            <td width="160" background="/include/manage/images/main/bg.gif"><div align="center">基本操作</div></td>
          </tr>
#foreach ($news in $newsList)
          <tr id="$!news.id">
            <td height="20" bgcolor="#FFFFFF"><div align="center">
              <input type="checkbox" name="sel_id" value="$!news.id" />
            </div></td>
            <td class="dragHandle" bgcolor="#FFFFFF" align="center">
            #if($news.fileType)
            	<img src="/include/system/filetype/$news.fileType" />
            #else
            	<img src="/include/system/filetype/html.gif" />
            #end
            </td>
            <td bgcolor="#FFFFFF"><a href="/manage_pic.ad?parameter=list&newsid=$!news.id" title="$!news.title">$!news.getTitle(30)</a></td>
            <td bgcolor="#FFFFFF">$!news.username</td>
            <td bgcolor="#FFFFFF">$!news.date</td>
            <td bgcolor="#FFFFFF"><a href="/manage_pic.ad?parameter=list&newsid=$!news.id"><img src="/include/manage/images/main/edt.gif" width="16" height="16" align="absmiddle" />编辑</a>
        	</td>
          </tr>
#end
        </table></td>
        <td width="8" background="/include/manage/images/main/tab_15.gif">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="35" background="/include/manage/images/main/tab_19.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="12" height="35"><img src="/include/manage/images/main/tab_18.gif" width="12" height="35" /></td>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td class="STYLE4">&nbsp;&nbsp;共有 $!rows 条记录，当前第 $!currentPage/$!totalPage 页</td>
            <td><table border="0" align="right" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="40"><a href="/manage_news.ad?parameter=page&page=1&tid=$!tid"><img src="/include/manage/images/main/first.gif" width="37" height="15" /></a></td>
                  <td width="45">#if($frontPage<1)<img src="/include/manage/images/main/back-no.gif" width="43" height="15" />#else<a href="/manage_news.ad?parameter=page&page=$!frontPage&tid=$!tid"><img src="/include/manage/images/main/back.gif" width="43" height="15" /></a>#end</td>
                  <td width="45">#if($nextPage>$totalPage)<img src="/include/manage/images/main/next-no.gif" width="43" height="15" />#else<a href="/manage_news.ad?parameter=page&page=$!nextPage&tid=$!tid"><img src="/include/manage/images/main/next.gif" width="43" height="15" /></a>#end</td>
                  <td width="40"><a href="/manage_news.ad?parameter=page&page=$!totalPage&tid=$!tid"><img src="/include/manage/images/main/last.gif" width="37" height="15" /></a></td>
                  <td width="100"><div align="center"><span>转到第
                    <input id="goPage" name="goPage" type="text" size="4" style="height:16px; width:20px; border:1px solid #999999;" /> 
                    页 </span></div></td>
                  <td width="40"><a href="javascript:location.href='/manage_news.ad?parameter=page&tid=$!tid&page='+document.getElementById('goPage').value"><img src="/include/manage/images/main/go.gif" width="37" height="15" /></a></td>
                </tr>
            </table></td>
          </tr>
        </table></td>
        <td width="16"><img src="/include/manage/images/main/tab_20.gif" width="16" height="35" /></td>
      </tr>
    </table></td>
  </tr>
</table>
</form>
<div id="rMenu" style="position:absolute; display:none;">
	<ul id="m_up"><li><a href="javascript:upOrder()">上移</a></li></ul>
	<ul id="m_down"><li><a href="javascript:downOrder()">下移</a></li></ul>
	<ul id="m_refresh"><li><a href="javascript:refreshPage()">刷新</a></li></ul>
</div>
</body>
</html>